replace `current_opt` with membership check
authorAndy Russell <arussell123@gmail.com>
Thu, 8 Dec 2016 22:32:33 +0000 (17:32 -0500)
committerAndy Russell <arussell123@gmail.com>
Thu, 8 Dec 2016 22:32:33 +0000 (17:32 -0500)
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/mod.rs

index b1690755f9656e2624cf137c41b7dab74e85c5e4..e0759ad81043cacc23e787a4ec820a7016b732d2 100644 (file)
@@ -449,8 +449,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         // we don't want to link it up.
         if src_dir.ends_with("deps") {
             // Don't lift up library dependencies
-            if self.ws.current_opt().map_or(false, |p| unit.pkg.package_id() != p.package_id())
-                    && !unit.target.is_bin() {
+            if self.ws.members().find(|&p| p != unit.pkg).is_some() && !unit.target.is_bin() {
                 None
             } else {
                 Some((
index dff80e493a7986d4eec1f98996ea4ce76e4bffef..809437c644abd9aa0dba631b8dd9f32f706c9435 100644 (file)
@@ -557,9 +557,7 @@ fn build_base_args(cx: &mut Context,
     let prefer_dynamic = (unit.target.for_host() &&
                           !unit.target.is_custom_build()) ||
                          (crate_types.contains(&"dylib") &&
-                          cx.ws.current_opt().map_or(false, |p| {
-                              *p.package_id() != *unit.pkg.package_id()
-                          }));
+                          cx.ws.members().find(|&p| p != unit.pkg).is_some());
     if prefer_dynamic {
         cmd.arg("-C").arg("prefer-dynamic");
     }